<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>登录</title>
 
<!-- Required Stylesheets -->
<link href="<%=request.getContextPath()%>/css/bootstrap/bootstrap.css" rel="stylesheet">
<link href="<%=request.getContextPath()%>/css/sigin.css" rel="stylesheet">

<!-- Required Javascript -->
<script src="<%=request.getContextPath()%>/js/jquery-3.1.1.min.js"></script>
<script src="<%=request.getContextPath()%>/js/ie-emulation-modes-warning.js"></script>
 <style>
       #tree{
          width:50px;
       }
    </style>
     <script type="text/javascript">
     //防止登陆页面在子框架中打开
    	$(function(){
    		if (top.location != self.location) { 
    			top.location = self.location; 
    		} 
    	});
    </script>
  </head>
<body>
	 <div class="container">

      <form class="form-signin" role="form">
        <h2 class="form-signin-heading">用户登录：</h2>
        <input id="username" name="username" type="username" class="form-control" placeholder="用户名" required autofocus>
        <input id="password" name="password" type="password" class="form-control" placeholder="密码" required>
        <!-- <div class="checkbox">
          <label>
            <input type="checkbox" value="remember-me"> Remember me
          </label>
        </div> -->
        <button class="btn btn-lg btn-primary btn-block" type="button"  onclick="login()">登录</button>
      </form>

    </div> <!-- /container -->


    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script type="text/javascript">
    /*!
     * IE10 viewport hack for Surface/desktop Windows 8 bug
     * Copyright 2014 Twitter, Inc.
     * Licensed under the Creative Commons Attribution 3.0 Unported License. For
     * details, see http://creativecommons.org/licenses/by/3.0/.
     */

    // See the Getting Started docs for more information:
    // http://getbootstrap.com/getting-started/#support-ie10-width

    (function () {
      'use strict';
      if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
        var msViewportStyle = document.createElement('style')
        msViewportStyle.appendChild(
          document.createTextNode(
            '@-ms-viewport{width:auto!important}'
          )
        )
        document.querySelector('head').appendChild(msViewportStyle)
      }
    })();
    
    function login(){
    	var username = $("#username").val();
    	var password = $("#password").val();
    	$.ajax({
    		url:"<%=request.getContextPath()%>/user_checkUser",
    		data:{"username":username,"password":password},
    		dataType:"json",
    		success:function(value){
    			if(value.success==true){
    				window.location.href="<%=request.getContextPath()%>/index.jsp";
    			}else{
    				alert(value.message);
    			}
    		}
    	});
    }
    </script>
  </body>
</body>	
</html>
